package com.stx.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="fc_types")
@SequenceGenerator(name="ty_id",sequenceName="ty_id",initialValue=1,allocationSize=1)
public class Film_type {
	
	@Id
	@Column(nullable=false)
    @GeneratedValue(generator="ty_id",strategy=GenerationType.SEQUENCE)
	private long  ty_id;
	@Column(nullable=false,length=100)
	private String ty_name;
	
//	@ManyToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY,mappedBy="film_type")
//	private Film film=new Film();
	
	@ManyToOne(cascade= {CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.EAGER,optional=false)
    @JoinColumn(name="fi_id")
	private Film film;
	
	
	public Film getFilm() {
		return film;
	}
	public void setFilm(Film film) {
		this.film = film;
	}
	public long getTy_id() {
		return ty_id;
	}
	public void setTy_id(long ty_id) {
		this.ty_id = ty_id;
	}
	public String getTy_name() {
		return ty_name;
	}
	public void setTy_name(String ty_name) {
		this.ty_name = ty_name;
	}
	
	
}
